<!DOCTYPE html>
<html lang=zh>
<head>
    <!-- so meta -->
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="HandheldFriendly" content="True">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
    <meta name="description" content="Mac OS  setup
转自 Mac 开发配置手册 ，根据自己情况增删部分内容。

1234567891011brew install mysqlbrew install postgresqlbrew install nginxbrew install python3brew install nodebrew install freetypebrew install pilbrew insta">
<meta property="og:type" content="article">
<meta property="og:title" content="Mac 开发配置手册">
<meta property="og:url" content="http://enomineCN.github.io/2017/04/28/macos-setup/index.html">
<meta property="og:site_name" content="enomine">
<meta property="og:description" content="Mac OS  setup
转自 Mac 开发配置手册 ，根据自己情况增删部分内容。

1234567891011brew install mysqlbrew install postgresqlbrew install nginxbrew install python3brew install nodebrew install freetypebrew install pilbrew insta">
<meta property="og:image" content="http://orangehat.u.qiniudn.com/iterm2-theme.png">
<meta property="og:updated_time" content="2017-04-28T08:27:09.000Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Mac 开发配置手册">
<meta name="twitter:description" content="Mac OS  setup
转自 Mac 开发配置手册 ，根据自己情况增删部分内容。

1234567891011brew install mysqlbrew install postgresqlbrew install nginxbrew install python3brew install nodebrew install freetypebrew install pilbrew insta">
<meta name="twitter:image" content="http://orangehat.u.qiniudn.com/iterm2-theme.png">
    
    
        
          <link rel="shortcut icon" href="/images/favicon.ico">
        
        
          <link rel="icon" type="image/png" href="/images/favicon-192x192.png" sizes="192x192">
        
        
          <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon.png">
        
    
    <!-- title -->
    <title>Mac 开发配置手册</title>
    <!-- styles -->
    <link rel="stylesheet" href="/lib/font-awesome/css/font-awesome.min.css">
    <link rel="stylesheet" href="/lib/meslo-LG/styles.css">
    <link rel="stylesheet" href="/lib/justified-gallery/justifiedGallery.min.css">
    <link rel="stylesheet" href="/css/style.css">
    <!-- rss -->
    
    
    <!-- jquery -->
    <script src="/lib/jquery/jquery.min.js"></script>
</head>

<body>
    
      <div id="header-post">
  <a id="menu-icon" href="#"><i class="fa fa-bars fa-lg"></i></a>
  <span id="menu">
    <span id="nav">
      <ul>
         
          <li><a href="/">Home</a></li>
         
          <li><a href="/about/">About</a></li>
         
          <li><a href="/archives/">Writing</a></li>
         
          <li><a href="http://github.com/enominecn">Projects</a></li>
        
      </ul>
    </span>
    <br/>
    <span id="actions">
      <span id="i-prev" class="info" style="display:none;">Previous post</span>
      <span id="i-next" class="info" style="display:none;">Next post</span>
      <span id="i-top" class="info" style="display:none;">Back to top</span>
      <span id="i-share" class="info" style="display:none;">Share post</span>
      <ul>
        
        
        <li><a class="icon" href="/2017/04/24/Iteration,Iterable,Iterator,Generator,yield-in-Python/"><i class="fa fa-chevron-right" aria-hidden="true" onmouseover='$("#i-next").toggle();' onmouseout='$("#i-next").toggle();'></i></a></li>
        
        <li><a class="icon" href="#" onclick="$('html, body').animate({ scrollTop: 0 }, 'fast');"><i class="fa fa-chevron-up" aria-hidden="true" onmouseover='$("#i-top").toggle();' onmouseout='$("#i-top").toggle();'></i></a></li>
        <li><a class="icon" href="#"><i class="fa fa-share-alt" aria-hidden="true" onmouseover='$("#i-share").toggle();' onmouseout='$("#i-share").toggle();' onclick='$("#share").toggle();return false;'></i></a></li>
      </ul>
    </span>
    <br/>
    <div id="share" style="display: none">
      <ul>
        <li><a class="icon" href="http://www.facebook.com/sharer.php?u=http://enomineCN.github.io/2017/04/28/macos-setup/"><i class="fa fa-facebook" aria-hidden="true"></i></a></li>
        <li><a class="icon" href="https://twitter.com/share?url=http://enomineCN.github.io/2017/04/28/macos-setup/&text=Mac 开发配置手册"><i class="fa fa-twitter" aria-hidden="true"></i></a></li>
        <li><a class="icon" href="http://www.linkedin.com/shareArticle?url=http://enomineCN.github.io/2017/04/28/macos-setup/&title=Mac 开发配置手册"><i class="fa fa-linkedin" aria-hidden="true"></i></a></li>
        <li><a class="icon" href="https://pinterest.com/pin/create/bookmarklet/?url=http://enomineCN.github.io/2017/04/28/macos-setup/&is_video=false&description=Mac 开发配置手册"><i class="fa fa-pinterest" aria-hidden="true"></i></a></li>
        <li><a class="icon" href="mailto:?subject=Mac 开发配置手册&body=Check out this article: http://enomineCN.github.io/2017/04/28/macos-setup/"><i class="fa fa-envelope" aria-hidden="true"></i></a></li>
        <li><a class="icon" href="https://getpocket.com/save?url=http://enomineCN.github.io/2017/04/28/macos-setup/&title=Mac 开发配置手册"><i class="fa fa-get-pocket" aria-hidden="true"></i></a></li>
        <li><a class="icon" href="http://reddit.com/submit?url=http://enomineCN.github.io/2017/04/28/macos-setup/&title=Mac 开发配置手册"><i class="fa fa-reddit" aria-hidden="true"></i></a></li>
        <li><a class="icon" href="http://www.stumbleupon.com/submit?url=http://enomineCN.github.io/2017/04/28/macos-setup/&title=Mac 开发配置手册"><i class="fa fa-stumbleupon" aria-hidden="true"></i></a></li>
        <li><a class="icon" href="http://digg.com/submit?url=http://enomineCN.github.io/2017/04/28/macos-setup/&title=Mac 开发配置手册"><i class="fa fa-digg" aria-hidden="true"></i></a></li>
        <li><a class="icon" href="http://www.tumblr.com/share/link?url=http://enomineCN.github.io/2017/04/28/macos-setup/&name=Mac 开发配置手册&description="><i class="fa fa-tumblr" aria-hidden="true"></i></a></li>
      </ul>
    </div>
    <div id="toc">
      <ol class="toc"><li class="toc-item toc-level-1"><a class="toc-link" href="#Mac-OS-setup"><span class="toc-number">1.</span> <span class="toc-text">Mac OS  setup</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#系统设置-SystemPreferences"><span class="toc-number">2.</span> <span class="toc-text">系统设置(SystemPreferences)</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#触控板"><span class="toc-number">2.0.1.</span> <span class="toc-text">触控板</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#Dock"><span class="toc-number">2.0.2.</span> <span class="toc-text">Dock</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#Finder"><span class="toc-number">2.0.3.</span> <span class="toc-text">Finder</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#菜单栏"><span class="toc-number">2.0.4.</span> <span class="toc-text">菜单栏</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#Spotlight"><span class="toc-number">2.0.5.</span> <span class="toc-text">Spotlight</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#互联网帐户"><span class="toc-number">2.0.6.</span> <span class="toc-text">互联网帐户</span></a></li></ol></li></ol></li><li class="toc-item toc-level-1"><a class="toc-link" href="#XCode"><span class="toc-number">3.</span> <span class="toc-text">XCode</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#Homebrew"><span class="toc-number">4.</span> <span class="toc-text">Homebrew</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#安装"><span class="toc-number">4.1.</span> <span class="toc-text">安装</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#基本使用"><span class="toc-number">4.2.</span> <span class="toc-text">基本使用</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#Homebrew-Cask"><span class="toc-number">4.3.</span> <span class="toc-text">Homebrew Cask</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#安装-1"><span class="toc-number">4.3.1.</span> <span class="toc-text">安装</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#搜索"><span class="toc-number">4.3.2.</span> <span class="toc-text">搜索</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#文件预览插件"><span class="toc-number">4.3.3.</span> <span class="toc-text">文件预览插件</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#OS-X-图形界面程序"><span class="toc-number">4.3.4.</span> <span class="toc-text">OS X 图形界面程序</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#iTerm2"><span class="toc-number">4.4.</span> <span class="toc-text">iTerm2</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#颜色和字体设置"><span class="toc-number">4.4.1.</span> <span class="toc-text">颜色和字体设置</span></a></li></ol></li></ol></li><li class="toc-item toc-level-1"><a class="toc-link" href="#Zsh"><span class="toc-number">5.</span> <span class="toc-text">Zsh</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#Git-Config"><span class="toc-number">6.</span> <span class="toc-text">Git Config</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#MySQL"><span class="toc-number">7.</span> <span class="toc-text">MySQL</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#安装-2"><span class="toc-number">7.0.1.</span> <span class="toc-text">安装</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#使用"><span class="toc-number">7.0.2.</span> <span class="toc-text">使用</span></a></li></ol></li></ol></li><li class="toc-item toc-level-1"><a class="toc-link" href="#Node-js"><span class="toc-number">8.</span> <span class="toc-text">Node.js</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#Npm-使用"><span class="toc-number">8.0.1.</span> <span class="toc-text">Npm 使用</span></a></li></ol></li></ol></li><li class="toc-item toc-level-1"><a class="toc-link" href="#Apps"><span class="toc-number">9.</span> <span class="toc-text">Apps</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#Developer-Tools"><span class="toc-number">9.0.1.</span> <span class="toc-text">Developer Tools</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#Productivity"><span class="toc-number">9.0.2.</span> <span class="toc-text">Productivity</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#Office-Apps"><span class="toc-number">9.0.3.</span> <span class="toc-text">Office Apps</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#Others"><span class="toc-number">9.0.4.</span> <span class="toc-text">Others</span></a></li></ol></li></ol></li></ol>
    </div>
  </span>
</div>

    
    <div class="content index width mx-auto px2 my4">
        
        <article class="post" itemscope itemtype="http://schema.org/BlogPosting">
  <header>
    
    <h1 class="posttitle" itemprop="name headline">
        Mac 开发配置手册
    </h1>



    <div class="meta">
      <span class="author" itemprop="author" itemscope itemtype="http://schema.org/Person">
        <span itemprop="name">enomine</span>
      </span>
      
    <div class="postdate">
        <time datetime="2017-04-28T08:36:33.000Z" itemprop="datePublished">2017-04-28</time>
    </div>


      
    <div class="article-tag">
        <i class="fa fa-tag"></i>
        <a class="tag-link" href="/tags/Mac/">Mac</a>, <a class="tag-link" href="/tags/MacOS/">MacOS</a>
    </div>


    </div>
  </header>
  

  <div class="content" itemprop="articleBody">
    <h1 id="Mac-OS-setup"><a href="#Mac-OS-setup" class="headerlink" title="Mac OS  setup"></a>Mac OS  setup</h1><blockquote>
<p>转自 <a href="https://www.gitbook.com/book/aaaaaashu/mac-dev-setup" target="_blank" rel="external">Mac 开发配置手册</a> ，根据自己情况增删部分内容。</p>
</blockquote>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div></pre></td><td class="code"><pre><div class="line">brew install mysql</div><div class="line">brew install postgresql</div><div class="line">brew install nginx</div><div class="line">brew install python3</div><div class="line">brew install node</div><div class="line">brew install freetype</div><div class="line">brew install pil</div><div class="line">brew install openssl</div><div class="line">brew install libjpeg zlib</div><div class="line"></div><div class="line">npm install gulp</div></pre></td></tr></table></figure>
<h1 id="系统设置-SystemPreferences"><a href="#系统设置-SystemPreferences" class="headerlink" title="系统设置(SystemPreferences)"></a>系统设置(SystemPreferences)</h1><p>在任何的操作系统中，首先你需要做一件事就是<strong>更新系统</strong>，点击窗口左上角的<strong>  &gt; 关于本机 &gt; 软件更新</strong> 。此外，如果这是一部新的电脑，你还需要到系统设置进行一些适当调整。如何调整，取决于个人喜好。</p>
<h3 id="触控板"><a href="#触控板" class="headerlink" title="触控板"></a>触控板</h3><ul>
<li>系统设置 &gt; 触控板<ul>
<li>光标与点击<ul>
<li>✓ 轻拍来点按</li>
<li>✓ 辅助点按</li>
<li>✓ 查找</li>
<li>✓ 三指拖移</li>
</ul>
</li>
<li>滚动缩放<ul>
<li>✓ 默认全选</li>
</ul>
</li>
<li>更多手势<ul>
<li>✓ 默认全选</li>
</ul>
</li>
</ul>
</li>
</ul>
<h3 id="Dock"><a href="#Dock" class="headerlink" title="Dock"></a>Dock</h3><ul>
<li>置于屏幕上的位置：左边</li>
<li>设置 Dock 图标更小（大小随个人喜好）</li>
<li>✓ 自动显示和隐藏 Dock</li>
</ul>
<h3 id="Finder"><a href="#Finder" class="headerlink" title="Finder"></a>Finder</h3><ul>
<li>Finder &gt; 显示<ul>
<li>显示标签页栏</li>
<li>显示路径栏</li>
<li>显示状态栏</li>
<li>自定工具栏 &gt; 去除所有按钮，仅剩搜索栏</li>
</ul>
</li>
<li>Finder &gt; 偏好设置<ul>
<li>通用<ul>
<li>开启新 Finder 窗口时打开：HOME「用户名」目录</li>
</ul>
</li>
<li>边栏<ul>
<li>添加 HOME「用户名」目录 和 创建代码文件目录</li>
<li>将 共享的(shared) 和 标记(tags) 目录去掉</li>
</ul>
</li>
</ul>
</li>
</ul>
<h3 id="菜单栏"><a href="#菜单栏" class="headerlink" title="菜单栏"></a>菜单栏</h3><ul>
<li>去掉蓝牙等无需经常使用的图标</li>
<li>将电池显示设置为百分比</li>
</ul>
<h3 id="Spotlight"><a href="#Spotlight" class="headerlink" title="Spotlight"></a>Spotlight</h3><ul>
<li>去掉字体和书签与历史记录等不需要的内容</li>
<li>设置合适的快捷键</li>
</ul>
<h3 id="互联网帐户"><a href="#互联网帐户" class="headerlink" title="互联网帐户"></a>互联网帐户</h3><ul>
<li>添加 iCloud 用户，同步日历，联系人和 Find my mac 等等</li>
</ul>
<h1 id="XCode"><a href="#XCode" class="headerlink" title="XCode"></a>XCode</h1><p>从 App store 或苹果开发者网站安装 <a href="https://developer.apple.com/xcode/" target="_blank" rel="external">Xcode</a> 。</p>
<p>紧接着，安装 Xcode command line tools，运行：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">xcode-select --install</div></pre></td></tr></table></figure>
<p>运行命令后，按照指引，你将完成 Xcode command line tools 安装。</p>
<hr>
<p><code>译注</code>:</p>
<p>如果你不是一名 iOS 或 OS X 开发者，可以跳过安装 XCode 的过程，直接安装 Xcode command line tools 。安装完成后，你将可以直接在 terminal 中使用主要的命令，比如：<code>make, GCC, clang, perl, svn, git, size, strip, strings, libtool, cpp</code>等等。</p>
<p>如果你想了解 Xcode command line tools 包含多少可用的命令，可以到 <code>/Library/Developer/CommandLineTools/</code> 查看。以下为其中的命令列表：</p>
<ul>
<li>ar</li>
<li>as</li>
<li>asa</li>
<li>bison</li>
<li>BuildStrings</li>
<li>c++</li>
<li>c89</li>
<li>c99</li>
<li>cc</li>
<li>clang</li>
<li>clang++</li>
<li>cmpdylib</li>
<li>codesign_allocate</li>
<li>CpMac</li>
<li>cpp</li>
<li>ctags</li>
<li>ctf_insert</li>
<li>DeRez</li>
<li>dsymutil</li>
<li>dwarfdump</li>
<li>dyldinfo</li>
<li>flex</li>
<li>flex++</li>
<li>g++</li>
<li>gatherheaderdoc</li>
<li>gcc</li>
<li>gcov</li>
<li>GetFileInfo</li>
<li>git</li>
<li>git-cvsserver</li>
<li>git-receive-pack</li>
<li>git-shell</li>
<li>git-upload-archive</li>
<li>git-upload-pack</li>
<li>gm4</li>
<li>gnumake</li>
<li>gperf</li>
<li>hdxml2manxml</li>
<li>headerdoc2html</li>
<li>indent</li>
<li>install_name_tool</li>
<li>ld</li>
<li>lex</li>
<li>libtool</li>
<li>lipo</li>
<li>lldb</li>
<li>lorder</li>
<li>m4</li>
<li>make</li>
<li>MergePef</li>
<li>mig</li>
<li>mkdep</li>
<li>MvMac</li>
<li>nasm</li>
<li>ndisasm</li>
<li>nm</li>
<li>nmedit</li>
<li>otool</li>
<li>pagestuff</li>
<li>projectInfo</li>
<li>ranlib</li>
<li>rebase</li>
<li>redo_prebinding</li>
<li>ResMerger</li>
<li>resolveLinks</li>
<li>Rez</li>
<li>RezDet</li>
<li>RezWack</li>
<li>rpcgen</li>
<li>segedit</li>
<li>SetFile</li>
<li>size</li>
<li>SplitForks</li>
<li>strings</li>
<li>strip</li>
<li>svn</li>
<li>svnadmin</li>
<li>svndumpfilter</li>
<li>svnlook</li>
<li>svnrdump</li>
<li>svnserve</li>
<li>svnsync</li>
<li>svnversion</li>
<li>unifdef</li>
<li>unifdefall</li>
<li>UnRezWack</li>
<li>unwinddump</li>
<li>what</li>
<li>xml2man</li>
<li>yacc</li>
</ul>
<h1 id="Homebrew"><a href="#Homebrew" class="headerlink" title="Homebrew"></a>Homebrew</h1><p>包管理工具可以让你安装和更新程序变得更方便，目前在 OS X 系统中最受欢迎的包管理工具是 <a href="http://brew.sh/" target="_blank" rel="external">Homebrew</a>.</p>
<h2 id="安装"><a href="#安装" class="headerlink" title="安装"></a>安装</h2><p>在安装 Homebrew 之前，需要将 <strong>Xcode Command Line Tools</strong> 安装完成，这样你就可以使用基于 Xcode Command Line Tools 编译的 Homebrew。</p>
<p>在 terminal 中复制以下命令（不包括 <code>$</code>），跟随指引，将完成 Hombrew 安装。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">$ ruby -e &quot;$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)&quot;</div></pre></td></tr></table></figure>
<p>紧接着，我们需要做一件事让通过 Homebrew 安装的程序的启动链接 (在 <code>/usr/local/bin</code>中）可以直接运行，无需将完整路径写出。通过以下命令将 <code>/usr/local/bin</code> 添加至 <code>$PATH</code> 环境变量中:</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">$ echo &apos;export PATH=&quot;/usr/local/bin:$PATH&quot;&apos; &gt;&gt; ~/.bash_profile</div></pre></td></tr></table></figure>
<p><strong>Cmd+T</strong> 打开一个新的 terminal 标签页，运行以下命令，确保 brew 运行正常。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">$ brew doctor</div></pre></td></tr></table></figure>
<hr>
<p><code>译注：</code></p>
<p>安装完成后，Homebrew 会将本地 <code>/usr/local</code> 初始化为 git 的工作树，并将目录所有者变更为当前所操作的用户，将来 <code>brew</code> 的相关操作不需要 sudo 。</p>
<h2 id="基本使用"><a href="#基本使用" class="headerlink" title="基本使用"></a>基本使用</h2><p>安装一个包，可以简单的运行：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">$ brew install &lt;package_name&gt;</div></pre></td></tr></table></figure>
<p>更新 Homebrew 在服务器端上的包目录：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">$ brew update</div></pre></td></tr></table></figure>
<p>查看你的包是否需要更新：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">$ brew outdated</div></pre></td></tr></table></figure>
<p>更新包：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">$ brew upgrade &lt;package_name&gt;</div></pre></td></tr></table></figure>
<p>Homebrew 将会把老版本的包缓存下来，以便当你想回滚至旧版本时使用。但这是比较少使用的情况，当你想清理旧版本的包缓存时，可以运行：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">$ brew cleanup</div></pre></td></tr></table></figure>
<p>查看你安装过的包列表（包括版本号）：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">$ brew list --versions</div></pre></td></tr></table></figure>
<h2 id="Homebrew-Cask"><a href="#Homebrew-Cask" class="headerlink" title="Homebrew Cask"></a>Homebrew Cask</h2><p>你已经感受到了使用 Homebrew 安装命令行程序的便利。那么接下来，我们将通过 Homebrew Cask 优雅、简单、快速的安装和管理 OS X 图形界面程序，比如 Google Chrome 和 Dropbox。</p>
<h3 id="安装-1"><a href="#安装-1" class="headerlink" title="安装"></a>安装</h3><p>安装 Homebrew-cask 是如此的简单直接，运行以下命令即可完成：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div></pre></td><td class="code"><pre><div class="line">$ brew install caskroom/cask/brew-cask</div><div class="line">$ brew cask install google-chrome // 安装 Google 浏览器</div><div class="line">$ brew update &amp;&amp; brew upgrade brew-cask &amp;&amp; brew cleanup // 更新</div></pre></td></tr></table></figure>
<h3 id="搜索"><a href="#搜索" class="headerlink" title="搜索"></a>搜索</h3><p>如果你想查看 cask 上是否存在你需要的 app，可以到 <a href="http://caskroom.io/" target="_blank" rel="external">caskroom.io</a> 进行搜索。</p>
<h3 id="文件预览插件"><a href="#文件预览插件" class="headerlink" title="文件预览插件"></a>文件预览插件</h3><p>有些 <a href="https://github.com/sindresorhus/quick-look-plugins" target="_blank" rel="external">插件</a> 可以让 Mac 上的文件预览更有效，比如语法高亮、markdown 渲染、json 预览等等。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div></pre></td><td class="code"><pre><div class="line">$ brew cask install qlcolorcode</div><div class="line">$ brew cask install qlstephen</div><div class="line">$ brew cask install qlmarkdown</div><div class="line">$ brew cask install quicklook-json</div><div class="line">$ brew cask install qlprettypatch</div><div class="line">$ brew cask install quicklook-csv</div><div class="line">$ brew cask install betterzipql</div><div class="line">$ brew cask install webpquicklook</div><div class="line">$ brew cask install suspicious-package</div></pre></td></tr></table></figure>
<h3 id="OS-X-图形界面程序"><a href="#OS-X-图形界面程序" class="headerlink" title="OS X 图形界面程序"></a>OS X 图形界面程序</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div></pre></td><td class="code"><pre><div class="line">$ brew cask install alfred</div><div class="line">$ brew cask install appcleaner</div><div class="line">$ brew cask install cheatsheet</div><div class="line">$ brew cask install dropbox</div><div class="line">$ brew cask install google-chrome</div><div class="line">$ brew cask install onepassword</div><div class="line">$ brew cask install sublime-text</div><div class="line">$ brew cask install totalfinder</div><div class="line">...</div></pre></td></tr></table></figure>
<hr>
<p><code>译注：</code> 译者本人并不喜欢 brew cask 的安装方式，更倾向于到 App Store 或官方下载 OS X 图形界面程序。主要因为名字不好记忆、偶尔需要手动更新，另外当你使用 Alfred 或 Spotlight ，你将发现将程序安装在 ~/Application 会很方便。</p>
<h2 id="iTerm2"><a href="#iTerm2" class="headerlink" title="iTerm2"></a>iTerm2</h2><p>作为一名开发者，我们常常花上很多时间在终端 上，如同武士的剑，一出手便知高低。所以让我们安装 Mac 上最强大的终端 <a href="http://www.iterm2.com/" target="_blank" rel="external">iTerm2</a> 吧！写码除虫，居家必备。</p>
<p>在 <strong>Finder</strong> 中，将 <strong>iTerm</strong> 拖拽进入 Application 文件夹中。然后，你可以在 <strong>Launchpad</strong> 中启动 iTerm。</p>
<h3 id="颜色和字体设置"><a href="#颜色和字体设置" class="headerlink" title="颜色和字体设置"></a>颜色和字体设置</h3><ul>
<li>在 Keys -&gt; Hotkey 中设置 <code>command + option + i</code> 快速显示和隐藏 iTerm</li>
<li>在 Profiles -&gt; Default -&gt; Check silence bell</li>
<li>下载 <a href="https://github.com/altercation/solarized/tree/master/iterm2-colors-solarized" target="_blank" rel="external">Solarized dark iterm colors</a>，在 Profiles -&gt; Default -&gt; Colors -&gt; Load Presets 将其导入，作为默认颜色。</li>
<li>在 Profiles -&gt; Text 改变游标（cursor）文字和颜色，随个人喜好。</li>
<li>更多设置，可参考 <a href="http://imwuyu.me/talk-about/cool-iterm2.html/" target="_blank" rel="external">打造好用的终端</a></li>
</ul>
<p><a href="http://orangehat.u.qiniudn.com/iterm2-theme.png" target="_blank" rel="external"><img src="http://orangehat.u.qiniudn.com/iterm2-theme.png" alt="Screen"></a></p>
<h1 id="Zsh"><a href="#Zsh" class="headerlink" title="Zsh"></a>Zsh</h1><p>我们将安装 <code>zsh</code> ，其拓展功能和主题将由 <code>oh-my-zsh</code> 提供。其中<code>Env.sh</code> 文件用于维护别名（aliases），输出（exports）和路径改变（path changes）等等，以免影响 <code>~/.zshrc</code>。</p>
<p>使用 Homebrew 完成 zsh 和 zsh completions 的安装</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">brew install zsh zsh-completions</div></pre></td></tr></table></figure>
<p>安装 oh-my-zsh 让 zsh 获得拓展功能和主题</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">curl -L https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh | sh</div></pre></td></tr></table></figure>
<p>用文本编辑器或 vi 打开 <code>.zshrc</code> 进行以下编辑:</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div></pre></td><td class="code"><pre><div class="line">ZSH_THEME=pygmalion</div><div class="line">alias zshconfig=&quot;vi ~/.zshrc&quot;</div><div class="line">alias envconfig=&quot;vi ~/Projects/config/env.sh&quot;</div><div class="line">plugins=(git colored-man colorize github jira vagrant virtualenv pip python brew osx zsh-syntax-highlighting)</div></pre></td></tr></table></figure>
<p>用文本编辑器或 vi 打开 <code>~/Projects/config/env.sh</code> 进行以下编辑:</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div><div class="line">24</div><div class="line">25</div><div class="line">26</div></pre></td><td class="code"><pre><div class="line">#!/bin/zsh</div><div class="line"></div><div class="line"># PATH</div><div class="line">export PATH=&quot;/usr/local/share/python:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin&quot;</div><div class="line">export EDITOR=&apos;vi -w&apos;</div><div class="line"># export PYTHONPATH=$PYTHONPATH</div><div class="line"># export MANPATH=&quot;/usr/local/man:$MANPATH&quot;</div><div class="line"></div><div class="line"># Virtual Environment</div><div class="line">export WORKON_HOME=$HOME/.virtualenvs</div><div class="line">export PROJECT_HOME=$HOME/Projects</div><div class="line">source /usr/local/bin/virtualenvwrapper.sh</div><div class="line"></div><div class="line"># Owner</div><div class="line">export USER_NAME=&quot;YOUR NAME&quot;</div><div class="line">eval &quot;$(rbenv init -)&quot;</div><div class="line"></div><div class="line"># FileSearch</div><div class="line">function f() &#123; find . -iname &quot;*$1*&quot; $&#123;@:2&#125; &#125;</div><div class="line">function r() &#123; grep &quot;$1&quot; $&#123;@:2&#125; -R . &#125;</div><div class="line"></div><div class="line">#mkdir and cd</div><div class="line">function mkcd() &#123; mkdir -p &quot;$@&quot; &amp;&amp; cd &quot;$_&quot;; &#125;</div><div class="line"></div><div class="line"># Aliases</div><div class="line">alias cppcompile=&apos;c++ -std=c++11 -stdlib=libc++&apos;</div></pre></td></tr></table></figure>
<hr>
<p><code>译注：</code></p>
<p>如果是新增环境变量或者是修改环境变量的值，都需要 source 一下才能立即生效。</p>
<p>如果是删除一个环境变量，必须输入 exit 以 logout 当前 shell ，然后再重新打开一个新的 shell 并 login 才能生效。</p>
<h1 id="Git-Config"><a href="#Git-Config" class="headerlink" title="Git Config"></a>Git Config</h1><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div></pre></td><td class="code"><pre><div class="line">git config --global user.name &quot;your username&quot;</div><div class="line">git config --global user.email &quot;your email&quot;</div><div class="line">ssh-keygen -t rsa -b 4096 -C &quot;your email&quot;</div></pre></td></tr></table></figure>
<h1 id="MySQL"><a href="#MySQL" class="headerlink" title="MySQL"></a>MySQL</h1><h3 id="安装-2"><a href="#安装-2" class="headerlink" title="安装"></a>安装</h3><p>我们将使用 Homebrew 安装 <a href="http://www.mysql.com/" target="_blank" rel="external">MySQL</a>，同时也会安装 MySQL 的相关文件。</p>
<p>安装 MySQL:</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">$ brew update # 这是一个好习惯</div><div class="line">$ brew install mysql</div></pre></td></tr></table></figure>
<p>在使用 MySQL 前，我们需要做一些设置：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div></pre></td><td class="code"><pre><div class="line">$ unset TMPDIR</div><div class="line">$ mkdir /usr/local/var</div><div class="line">$ mysql_install_db --verbose --user=`whoami` --basedir=&quot;$(brew --prefix mysql)&quot; --datadir=/usr/local/var/mysql --tmpdir=/tmp</div></pre></td></tr></table></figure>
<h3 id="使用"><a href="#使用" class="headerlink" title="使用"></a>使用</h3><p>启动 MySQL 服务，运行 <code>mysql.server</code></p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">$ mysql.server start</div></pre></td></tr></table></figure>
<p>关闭 MySQL，运行：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">$ mysql.server stop</div></pre></td></tr></table></figure>
<p>你可以了解更多 <code>mysql.server</code> 的命令，运行：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">$ mysql.server --help</div></pre></td></tr></table></figure>
<p>登录 MySQL, 运行:</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">$ mysql -uroot</div></pre></td></tr></table></figure>
<p><strong>Note</strong>: 默认情况下，MySQL 用户 <code>root</code> 没有密码，这对本地开发没有关系，但如果你希望修改密码，你可以运行:</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">$ mysqladmin -u root password &apos;new-password&apos;</div></pre></td></tr></table></figure>
<hr>
<p><code>译注：</code></p>
<p>当你在设置密码时出现问题，可以参考 <a href="https://ruby-china.org/topics/1901" target="_blank" rel="external">lgn21st</a> 的方式。</p>
<p>此外，如果你觉得敲那么多命令是一件很麻烦的事情，那么你也可以参考 <a href="http://elf8848.iteye.com/blog/1914209" target="_blank" rel="external">Mac OS安装 MySQL（使用二进制PGK包安装）</a></p>
<h1 id="Node-js"><a href="#Node-js" class="headerlink" title="Node.js"></a>Node.js</h1><p>使用 Homebrew 安装 <a href="http://nodejs.org/" target="_blank" rel="external">Node.js</a>:</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">$ brew update</div><div class="line">$ brew install node</div></pre></td></tr></table></figure>
<p>一般 Node modules 通常被安装在每个项目的本地文件夹 <code>node_modules</code>， 但有几个包推荐你安装在全局：</p>
<p><a href="http://coffeescript.org/" target="_blank" rel="external">CoffeeScript</a>、 <a href="http://lesscss.org/" target="_blank" rel="external">Less</a>、 <a href="http://gruntjs.com/" target="_blank" rel="external">Grunt</a> 或 <a href="http://gulpjs.com/" target="_blank" rel="external">Gulp</a></p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div></pre></td><td class="code"><pre><div class="line">$ npm install -g coffee-script</div><div class="line">$ npm install -g less</div><div class="line">$ npm install -g grunt-cli</div><div class="line">$ npm install -g gulp</div></pre></td></tr></table></figure>
<h3 id="Npm-使用"><a href="#Npm-使用" class="headerlink" title="Npm 使用"></a>Npm 使用</h3><p>安装包:</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">$ npm install &lt;package&gt;     # 安装在本地项目中</div><div class="line">$ npm install -g &lt;package&gt;  # 安装在全局</div></pre></td></tr></table></figure>
<p>安装包，并且将其保存你项目中的 <code>package.json</code> 文件:</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">$ npm install &lt;package&gt; --save</div></pre></td></tr></table></figure>
<p>查看 npm 安装的内容:</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">$ npm list     # 本地</div><div class="line">$ npm list -g  # 全局</div></pre></td></tr></table></figure>
<p>查看过期的包（本地或全局）:</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">$ npm outdated [-g]</div></pre></td></tr></table></figure>
<p>更新全部或特别指定一个包:</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">$ npm update [&lt;package&gt;]</div></pre></td></tr></table></figure>
<p>卸载包:</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">$ npm uninstall &lt;package&gt;</div></pre></td></tr></table></figure>
<h1 id="Apps"><a href="#Apps" class="headerlink" title="Apps"></a>Apps</h1><p>这里推荐的 apps 在开发者圈子内普遍评价不错，能便利的处理日常的开发和使用的任务。以下推荐分为四类：</p>
<ul>
<li>开发者工具</li>
<li>生产力工具</li>
<li>办公工具</li>
<li>其他</li>
</ul>
<h3 id="Developer-Tools"><a href="#Developer-Tools" class="headerlink" title="Developer Tools"></a>Developer Tools</h3><ul>
<li><a href="https://www.google.com/intl/en/chrome/browser/" target="_blank" rel="external">Google Chrome</a></li>
<li><a href="https://www.jetbrains.com/webstorm/" target="_blank" rel="external">Webstorm</a></li>
<li><a href="http://bohemiancoding.com/sketch/" target="_blank" rel="external">Sketch</a></li>
<li><a href="http://kapeli.com/dash" target="_blank" rel="external">Dash</a></li>
<li><a href="http://www.sequelpro.com/" target="_blank" rel="external">Sequel Pro</a></li>
<li><a href="https://www.parallels.com/hk/" target="_blank" rel="external">Parallels</a></li>
<li><a href="https://mac.github.com/" target="_blank" rel="external">Github</a></li>
</ul>
<h3 id="Productivity"><a href="#Productivity" class="headerlink" title="Productivity"></a>Productivity</h3><ul>
<li><a href="https://agilebits.com/onepassword" target="_blank" rel="external">1Password</a> : 跨平台的密码管理工具</li>
<li><a href="http://www.alfredapp.com/" target="_blank" rel="external">Alfred 2</a> : 搜索工具，强烈建议更新至 power pack，可以参考 <a href="http://www.zhihu.com/question/20656680" target="_blank" rel="external">借助 Alfred 2 的 Workflows 功能可以做哪些好玩的事情？</a></li>
<li><a href="http://www.freemacsoft.net/appcleaner/" target="_blank" rel="external">AppCleaner</a>: 应用程序卸载工具</li>
<li><a href="https://www.dropbox.com/" target="_blank" rel="external">Dropbox</a>: 文件同步工具</li>
<li><a href="http://reederapp.com/" target="_blank" rel="external">Reeder</a>：RSS 阅读工具</li>
<li><a href="https://getpocket.com/" target="_blank" rel="external">Pocket</a> : 稍后阅读工具</li>
<li><a href="http://spectacleapp.com/" target="_blank" rel="external">Spectacle</a> : 让窗口成比例的显示，在写代码调试的时候很方便</li>
<li><a href="http://wakaba.c3.cx/s/apps/unarchiver.html" target="_blank" rel="external">Unarchiver</a>: 支持多种格式（包括 windows下的格式）的压缩/解压缩工具</li>
<li><a href="https://www.omnigroup.com/omnifocus" target="_blank" rel="external">OminiFocus</a> ：时间管理工具</li>
<li><a href="http://25.io/mou/" target="_blank" rel="external">Mou</a>：Markdown 编辑器，国人出品</li>
<li>[Sip] 取色器</li>
<li>[MindeNode] 思维导图</li>
</ul>
<h3 id="Office-Apps"><a href="#Office-Apps" class="headerlink" title="Office Apps"></a>Office Apps</h3><ul>
<li><a href="http://www.apple.com/mac/keynote/" target="_blank" rel="external">Keynote</a></li>
<li><a href="http://www.apple.com/mac/numbers/" target="_blank" rel="external">Numbers</a></li>
<li><a href="http://www.apple.com/mac/pages/" target="_blank" rel="external">Pages</a></li>
<li><a href="http://www.microsoft.com/mac/buy" target="_blank" rel="external">Microsoft Office</a></li>
</ul>
<h3 id="Others"><a href="#Others" class="headerlink" title="Others"></a>Others</h3><ul>
<li><a href="http://www.grandtotal.biz/CheatSheet/" target="_blank" rel="external">CheatSheet</a> : 长按 <code>command</code> ，将能查看当前程序的快捷键</li>
<li><a href="https://tapbots.com/software/tweetbot/mac/" target="_blank" rel="external">Tweetbot</a>: 最好的 twitter 客户端，优雅，精致</li>
</ul>

  </div>
</article>



      </div>
    <footer id="footer">
  <div class="footer-left">
    Copyright &copy; 2017 enomine
  </div>
  <div class="footer-right">
    <nav>
      <ul>
         
          <li><a href="/">Home</a></li>
         
          <li><a href="/about/">About</a></li>
         
          <li><a href="/archives/">Writing</a></li>
         
          <li><a href="http://github.com/enominecn">Projects</a></li>
        
      </ul>
    </nav>
  </div>
</footer>

    <script src="/lib/justified-gallery/jquery.justifiedGallery.min.js"></script>
<script src="/js/main.js"></script>
<!-- Google Analytics -->

    <script type="text/javascript">
        (function(i,s,o,g,r,a,m) {i['GoogleAnalyticsObject']=r;i[r]=i[r]||function() {
        (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
        m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
        })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
        ga('create', 'UA-86660611-1', 'auto');
        ga('send', 'pageview');
    </script>

<!-- Disqus Comments -->


</body>
</html>
